package be.donovan.gui.helper.components;

import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;

import org.jdesktop.swingx.JXTable;
import org.springframework.beans.factory.InitializingBean;

import be.donovan.gui.helper.ImageLoader;


/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class DTOInterfacePanel extends MVCPanel implements InitializingBean {

	public JScrollPane scrollPane;

	public JXTable catalogTable;

	public JButton buttonSave;

	public JButton buttonClose;

	public JButton buttonNew;

	public JPanel buttonsPanel;

	/**
	 * Auto-generated main method to display this JPanel inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new DTOInterfacePanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public DTOInterfacePanel() {
		super();
		initGUI();
	}

	private void initGUI() {
		GridBagLayout thisLayout = new GridBagLayout();
		thisLayout.rowWeights = new double[] { 0.1, 0.0 };
		thisLayout.rowHeights = new int[] { 256, 40 };
		thisLayout.columnWeights = new double[] { 0.1 };
		thisLayout.columnWidths = new int[] { 7 };
		this.setLayout(thisLayout);
		this.setPreferredSize(new java.awt.Dimension(800, 600));

		scrollPane = new JScrollPane();
		this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
						0, 0, 0, 0), 0, 0));
		catalogTable = new JXTable();
		
		scrollPane.setViewportView(catalogTable);
		buttonsPanel = new JPanel();
		FlowLayout buttonsPanelLayout = new FlowLayout();
		buttonsPanel.setLayout(buttonsPanelLayout);
		this.add(buttonsPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
						0, 0, 0, 0), 0, 0));

		buttonSave = new JButton();
		buttonsPanel.add(buttonSave);
		buttonSave.setText("Save All");
		buttonSave.setIcon(ImageLoader.getImageIcon("save.png"));
		
		buttonClose = new JButton();
		buttonsPanel.add(buttonClose);
		buttonClose.setText("Close");
		buttonClose.setIcon(ImageLoader.getImageIcon("cancel.png"));

		buttonNew = new JButton();
		buttonsPanel.add(buttonNew);
		buttonNew.setText("New");
		buttonNew.setIcon(ImageLoader.getImageIcon("add.png"));
	}

	/**
	 * This method should return an instance of this class which does NOT
	 * initialize it's GUI elements. This method is ONLY required by Jigloo if
	 * the superclass of this class is abstract or non-public. It is not needed
	 * in any other situation.
	 */
	public static Object getGUIBuilderInstance() {
		return new DTOInterfacePanel(Boolean.FALSE);
	}

	/**
	 * This constructor is used by the getGUIBuilderInstance method to provide
	 * an instance of this class which has not had it's GUI elements initialized
	 * (ie, initGUI is not called in this constructor).
	 */
	public DTOInterfacePanel(Boolean initGUI) {
		super();
	}

}
